<?php
namespace app\admin\controller;
use app\admin\logic\DepartmentLogic;

/**
 * 部门api控制器
 * Created by PhpStorm.
 * User: tyll
 * Date: 2019/11/15
 * Time: 16:32
 */
class Department extends Base {

    public function __construct(){
        parent::__construct();
        $this->d_logic = new DepartmentLogic();
    }

    /**
     * 获取公用部门
     * @return \think\response\Json
     */
    public function ajax_get_public_department(){
        $params = input();
        $r = $this->check_admin_token($params);
        if($r['code'] != 1){
            return json($r);
        }

        $maps = $this->d_logic->get_search_public_department_maps();
        $list = model('user')->get_column($maps,'DISTINCT department','','','','','',false);

        $data['list'] = $list;
        return json($this->d_logic->get_response(1,'OK',$data));
    }
}
